package com.speed.interceptor;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;

public class ActivitesInterceptor implements Interceptor{

	@Override
	public void intercept(Invocation inv) {
		if(before(inv)){
			inv.getController().forwardAction("/user/index");
		}else{
			inv.invoke();
		}
	}
	
	private boolean before(Invocation inv){
		Object user = inv.getController().getSession().getAttribute("user");
		return user == null;
	}

}
